<script setup>
import { ref } from 'vue';

// 状态变量控制显示哪个列表
const activeTab = ref('confirmed');
const arr = [
  {
    icon:'../../static/image/title.png',
    college: 'A学院',
    card:'123456789',
    totalnumber:'7人',
    restnumber:'4人',
    yindao:'3人',
    counselor: '张明',
    employeeId: '10086',
    phone: '13900000000',
  },
]
const arr1 = [
  {
    icon:'../../static/image/title.png',
    college: 'A学院',
    card:'123456789',
    totalnumber:'7人',
    restnumber:'4人',
    yindao:'3人',
    counselor: '张明',
    employeeId: '10086',
    phone: '13900000000',
  },
  {
    icon:'../../static/image/title.png',
    college: 'A学院',
    card:'123456789',
    totalnumber:'7人',
    restnumber:'4人',
    yindao:'3人',
    counselor: '张明',
    employeeId: '10086',
    phone: '13900000000',
  },
]
const toNext = (to) => {
  uni.navigateTo({
    url:to
  })
}
</script>

<template>
  <view class="container">
    <!-- 顶部标题区域 -->
    <view class="header">
      <text class="school-year">2025-2026学年第一学期</text>
      <text class="date">2025年9月15日</text>
    </view>
    <!-- 学生总数卡片 -->
    <view class="total-card">
      <text class="total-label">学生总数:</text>
      <text class="total-number">13</text>
      <text class="total-unit">人</text>
    </view>
    <!-- 统计信息列表 -->
    <view class="stats-list">
      <view class="stat-item">
        <text class="stat-label">请假人数: 4人</text>
        <view class="stat-link" @click="toNext('/pages/user/faction1-2')">
          <text>查看名单</text>
          <uni-icons type="right" size="16"></uni-icons>
        </view>
      </view>

      <view class="stat-item">
        <text class="stat-label">应在人数: 9人</text>
        <view class="stat-link" @click="toNext('/pages/user/faction1-2')">
          <text>查看名单</text>
          <uni-icons type="right" size="16"></uni-icons>
        </view>
      </view>
    </view>
    <!-- 异常统计 -->
    <view class="abnormal-section">
      <view class="abnormal-item">
        <text class="abnormal-label">本院今日异常总数: 3人</text>
        <view class="stat-link" @click="toNext('/pages/user/faction1-2')">
          <text>查看名单</text>
          <uni-icons type="right" size="16"></uni-icons>
        </view>
      </view>

      <view class="keywords-section">
        <text class="keywords-label">今日上报关键词:</text>
        <view class="keywords">
          <text class="keyword">#校外住宿#</text>
          <text class="keyword">#刚办理走读#</text>
        </view>
      </view>
    </view>
    <!-- 学院确认状态 -->
    <view class="button">
      <button
          class="tab-btn"
          :class="{ active: activeTab == 'confirmed' }"
          @click="activeTab = 'confirmed'"
      >
        已确认
      </button>
      <button
          class="tab-btn"
          :class="{ active: activeTab == 'unconfirmed' }"
          @click="activeTab = 'unconfirmed'"
      >
        未确认
      </button>
    </view>
    <!-- 学院列表 -->
    <view v-if="activeTab == 'confirmed'">
      <view class="list" v-for="(item,user) in arr1" :key="user">
        <view class="title1">
          <view>
            <image class="icon" :src ='item.icon'></image>
          </view>
          <view class="contain">
            <view class="college">{{item.college}}</view>
            <text class="card">{{item.card}}</text>
          </view>
        </view>
        <view class="totalnumber">学院学生总人数：{{item.totalnumber}}</view>
        <view class="restnumber">请假人数：{{item.restnumber}}</view>
        <view class="yindao">应到人数：{{item.yindao}}</view>
        <view class="divider"></view>
        <view class="counselor">确认人姓名：{{item.counselor}}</view>
        <view class="employeeId">工号：{{item.employeeId}}</view>
        <view class="phone">联系电话：{{item.phone}}</view>
      </view>
    </view>
    <view v-if="activeTab == 'unconfirmed'">
      <view class="list" v-for="(item,user) in arr" :key="user">
        <view class="title1">
          <view>
            <image class="icon" :src ='item.icon'></image>
          </view>
          <view class="contain">
            <view class="college">{{item.college}}</view>
            <text class="card">{{item.card}}</text>
          </view>
        </view>
        <view class="totalnumber">学院学生总人数：{{item.totalnumber}}</view>
        <view class="restnumber">请假人数：{{item.restnumber}}</view>
        <view class="yindao">应到人数：{{item.yindao}}</view>
        <view class="divider"></view>
        <view class="counselor">确认人姓名：{{item.counselor}}</view>
        <view class="employeeId">工号：{{item.employeeId}}</view>
        <view class="phone">联系电话：{{item.phone}}</view>
      </view>
    </view>
  </view>
</template>

<style scoped>
.container {
  background-color: #f5f5f5;
  min-height: 100vh;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
/* 顶部标题样式 */
.header {
  margin-bottom: 20px;
}
.school-year {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  display: block;
  margin-bottom: 8px;
}
.date {
  font-size: 14px;
  color: #666;
}
/* 学生总数卡片样式 */
.total-card {
  background: linear-gradient(135deg, #e63946, #d62828);
  border-radius: 12px;
  padding: 20px 16px;
  color: white;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
  position: relative;
  overflow: hidden;
}
.total-card::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 120px;
  height: 120px;
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15) 0%, transparent 60%);
  border-radius: 50%;
}
.total-label {
  font-size: 16px;
  opacity: 0.9;
}
.total-number {
  font-size: 36px;
  font-weight: 700;
  margin: 0 8px;
}
.total-unit {
  font-size: 18px;
  opacity: 0.9;
}
/* 统计列表样式 */
.stats-list {
  background-color: white;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
}
.stat-item:last-child {
  border-bottom: none;
}
.stat-label {
  font-size: 16px;
  color: #333;
}
.stat-link {
  display: flex;
  align-items: center;
  color: #1677ff;
  font-size: 14px;
}
.stat-link text {
  margin-right: 4px;
}
/* 异常统计区域 */
.abnormal-section {
  background-color: white;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.abnormal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.abnormal-label {
  font-size: 16px;
  color: #333;
}
.keywords-section {
  margin-top: 12px;
}
.keywords-label {
  font-size: 16px;
  color: #333;
  display: block;
  margin-bottom: 8px;
}
.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.keyword {
  background-color: #fff1f0;
  color: #cf1322;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 14px;
}
/* 学院状态标签 */
.button{
  width: 180px;
  height: 30px;
  background: #E2E4E9;
  border-radius: 15px;
  margin: 15px;
  display: flex;
}
.tab-btn.active {
  background-color: #B41F2F;
  color: white;
  border-color: #B41F2F;
}
.tab-btn {
  flex: 1;
  height: 36px;
  background-color: white;
  border: 1px solid #E2E4E9;
  border-radius: 18px;
  font-size: 14px;
  color: #666;
}
.status-tab:not(.active) {
  color: #666;
  background-color: #f9f9f9;
}
/* 学院列表样式 */
.list{
  width: 400px;
  height: 200px;
  background: #FFFFFF;
  border-radius: 12px;
  margin-top: 15px;
}
.phone{
  width: 319px;
  height: 25px;
  font-weight: 400;
  font-size: 12px;
  color: #5C5C5C;
  letter-spacing: 0;
  line-height: 13px;
  margin-left: 12px;
}
.employeeId{
  width: 319px;
  height: 25px;
  font-weight: 400;
  font-size: 12px;
  color: #5C5C5C;
  letter-spacing: 0;
  line-height: 13px;
  margin-left: 12px;
}
.counselor{
  width: 319px;
  height: 25px;
  font-weight: 400;
  font-size: 12px;
  color: #5C5C5C;
  letter-spacing: 0;
  line-height: 13px;
  margin-left: 12px;
}
.divider {
  height: 1px;
  background-color: #e5e5e5;
  margin: 5px 5px;
  width: 100%;
}
.yindao{
  width: 319px;
  height: 25px;
  font-weight: 400;
  font-size: 12px;
  color: #5C5C5C;
  letter-spacing: 0;
  line-height: 13px;
  margin-left: 12px;
}
.restnumber{
  width: 319px;
  height: 25px;
  font-weight: 400;
  font-size: 12px;
  color: #5C5C5C;
  letter-spacing: 0;
  line-height: 13px;
  margin-left: 12px;
}
.totalnumber{
  width: 319px;
  height: 25px;
  font-weight: 400;
  font-size: 12px;
  color: #5C5C5C;
  letter-spacing: 0;
  line-height: 13px;
  margin-left: 12px;
}
.contain{
  display: flex;
  flex: 1;
  justify-content: space-between;
  align-items: center;
  padding-right: 12px;
}
.title1{
  display: flex;
  flex-direction: row;
  margin-left: 12px;
  margin-top: 20px;
}
.icon{
  width: 16px;
  height: 16px;
}
.college{
  width: 45px;
  height: 21px;
  font-weight: 500;
  font-size: 15px;
  color: #000000;
  letter-spacing: 0;
  margin-left: 2px;
}
.card{
  height: 13px;
  font-weight: 400;
  font-size: 12px;
  color: #7A7A7A;
  letter-spacing: 0;
  line-height: 13px;
  text-align: right;
}
</style>